package com.edais.dao;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.edais.domain.BorrowerCompany;
import com.edais.persistence.WeixinEnjoyMapper;
import com.edais.vo.InvestVo;

@Repository

public class WeixinEnjoyDao {
	@Autowired
	private WeixinEnjoyMapper weixinEnjoyMapper;

	/**
	 * @Description: 获取投资理财列表
	 * @param @param map
	 * @param @return
	 * @param @throws Exception
	 * @return List<InvestVo>
	 * @throws
	 * @author chenshufeng
	 * @date 2016-6-7
	 */
	public List<InvestVo> getInvestList(Map<String, Object> map)
			throws Exception {
		return weixinEnjoyMapper.getInvestList(map);
	}
	/**
	 * @Description: 获取投资理财列表总记录
	 * @param @param map
	 * @param @return
	 * @param @throws Exception   
	 * @return Integer  
	 * @throws
	 * @author chenshufeng
	 * @date 2016-6-7
	 */
	public Integer getInvestListSize(Map<String, Object> map) throws Exception {
		return weixinEnjoyMapper.getInvestListSize(map);
	}

	/**
	 * @Description: 获取标的详情
	 * @param map
	 * @return String
	 * @throws  Exception
	 * @author 王丹清
	 * @date 2016-6-7
	 */
	public Map<String, Object> queryScaDetail(Map<String, String> paramsMap) {
		return weixinEnjoyMapper.queryScaDetail(paramsMap);
	}

	/**
	 * @Description: 获取协议详情
	 * @param map
	 * @return String
	 * @throws  Exception
	 * @author 王丹清
	 * @date 2016-6-7
	 */
	public BorrowerCompany queryBrCompany(Map<String, String> paramsMap) {
		return weixinEnjoyMapper.queryBrCompany(paramsMap);
	}
	
	/**
	 * @Description: 查询标的列表
	 * @param map
	 * @return String
	 * @throws  Exception
	 * @author 王丹清
	 * @date 2016-6-7
	 */
	public List<Map<String, Object>> queryEnjoyLoanList(Map<String, Object> paramsMap) {
		return weixinEnjoyMapper.queryEnjoyLoanList(paramsMap);
	}

	/**
	 * @Description: 查询标的总件数
	 * @param map
	 * @return String
	 * @throws  Exception
	 * @author 王丹清
	 * @date 2016-6-7
	 */
	public int queryEnjoyLoanCount(Map<String, Object> paramsMap) {
		return weixinEnjoyMapper.queryEnjoyLoanCount(paramsMap);
	}
	
	/**
	 * @Description: 保存或修改ios设备信息
	 * @param @param map
	 * @param @throws Exception   
	 * @return void  
	 * @throws
	 * @author chenshufeng
	 * @date 2016-6-22
	 */
	public void saveOrUpdateIosDeviceInfo(Map<String, Object> map) throws Exception {
		Integer count = weixinEnjoyMapper.countSumIosInfo(map);
		if(count != null && count>0){
			weixinEnjoyMapper.updateIosDeviceInfo(map);
		}else{
			weixinEnjoyMapper.saveIosDeviceInfo(map);
		}
	}
	/**
	 * @Description: 优享计划详情(网站)
	 * @param @param map
	 * @param @return
	 * @param @throws Exception   
	 * @return Map<String,Object>  
	 * @throws
	 * @author chenshufeng
	 * @date 2016-9-4
	 */
	public Map<String, Object> getEnjoyPlanDetail(Map<String, String> map) throws Exception {
		return weixinEnjoyMapper.getEnjoyPlanDetail(map);
	}

//	/**
//	 * 通过t_banner_config表获取investBanner
//	 * @return
//     */
//	public List<Map<String, String>> getInvestBannerList() throws Exception {
//		return weixinEnjoyMapper.getInvestBannerList();
//	}
	/**
	 * @Description: 获取数据库系统时间(时分秒)
	 * @param @return   
	 * @return String  
	 * @throws
	 * @author chenshufeng
	 * @date 2016-12-14
	 */
	public String querySysTime() throws Exception  {
		return weixinEnjoyMapper.querySysTime();
	}
}
